import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  // 配置项目别名
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
  server: {
    proxy: {
      '/ksgl': {
        target: 'http://192.168.0.114:9081',
        ws: true,
        changeOrigin: true,
        // pathRewrite: {
        // 	"^/dev-api": ""
        // }
      },
      '/yhgl': {
        target: 'http://192.168.0.114:9081',
        ws: true,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/yhgl/, "/yhgl"),
      },
    },
  },
})
